#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>

int main()
{
    int fd=open("log.txt",O_WRONLY|O_CREAT|O_TRUNC,0666);
    dup2(fd,1);
    printf("hello printf\n");
    fprintf(stdout,"hello fprintf\n");
    const char* s="hello fputs\n";
    fputs(s,stdout);

    const char* ss="hello write\n";
    write(1,ss,strlen(ss));

    fork();

    return 0;
}
